//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright 2007 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   COUNTRY
// AUTHOR           :   Craig Chun
// DATE CREATE      :   2007/07/12
// DESCRIPTION      :   a SEARCH FORM file for the function, COUNTRY
//                  :
//                  :
//                  :
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2007/07/12   Craig Chun      1.0                 source is generated.
//
//
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

package com.erp.app.setup.country.web;

import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.erp.app.common.ProjectConstants;
import com.erp.app.setup.codeSetup.pk.CodeHdrPk;
import com.erp.app.util.web.BeanValidator;
import com.erp.framework.controller.form.SimpleSearchStyleFormTemplate;
import com.erp.framework.util.logger.Logger;

/**
* <p>A <strong>SearchForm</strong> is a JavaBean which provides property
* getter and setter methods for all of the bean properties, and implements
* <code>Serializable</code>, as required by the JavaBean specification
* The main purpose for this bean is to get the user search criteria input
* from the web browsers.
*
* @author          Craig Chun
* @version 1.0     2007/07/12
* @since           FrameWork 1.0
*
*/

// Note:
// Currently only generates the first -1 fields of a table
// (excluding the COMPANY_CODE field).
// However, this number can be set in GenConstants.NO_CRITERIA

public class CountrySearchForm extends SimpleSearchStyleFormTemplate {

	//Searching Criteria Attributes (DB Table Name: T_COUNTRY_HDR)
	private String srchCompanyCode;                                                                    //DB Column Name: COMPANY_CODE
	private String srchHdrStatus;                                                                      //DB Column Name: STATUS
	private String srchCountryCodeFr;                                                                  //DB Column Name: COUNTRY_CODE
	private String srchCountryCodeTo;                                                                  //DB Column Name: COUNTRY_CODE
	private String srchHdrCountryNameFr;                                                               //DB Column Name: COUNTRY_NAME
	private String srchHdrCountryNameTo;                                                               //DB Column Name: COUNTRY_NAME
	private String srchHdrIsoCountryCodeFr;                                                            //DB Column Name: ISO_COUNTRY_CODE
	private String srchHdrIsoCountryCodeTo;                                                            //DB Column Name: ISO_COUNTRY_CODE
	private String srchHdrCountryAbbrFr;                                                               //DB Column Name: COUNTRY_ABBR
	private String srchHdrCountryAbbrTo;                                                               //DB Column Name: COUNTRY_ABBR

	private String editCountryNo;

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      the action errors array
	* @author     Craig Chun
	* @since      Framework 1.0
	*/
	public void validateSearch(ActionErrors errors) {

		try {

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      mapping      the action mapping
	* @param      formIn       the action form
	* @param      request      the http request
	* @param      response     the http response
	* @param      errors       the action errors array
	* @author     Craig Chun
	* @since      Framework 1.0
	*/
	public void moreValidateSearch(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {


		BeanValidator validator = new BeanValidator();
		validator.validate(mapping, formIn, request, response, errors);
	}

	/**
	* Converts to a string representing the data in this object.
	* A new <code>String</code> object is allocated and initialized to
	* contain the character sequence currently represented by this
	* object. This <code>String</code> is then returned. Subsequent
	* changes to this object do not affect the contents of the
	* <code>String</code>.
	*
	* @return     a string representation of the object.
	* @see        java.lang.Object#toString()
	* @author     Craig Chun
	* @since      Framework 1.0
	*/
	public String toString() {
		String pkStr = "PK: {srchCountryCodeFr = " + this.srchCountryCodeFr
			+ "\n, srchCountryCodeTo = " + this.srchCountryCodeTo + "}\n";

		String colStr = "COL: {srchHdrCountryNameFr = " + this.srchHdrCountryNameFr
			+ "\n, srchHdrCountryNameTo = " + this.srchHdrCountryNameTo
			+ "\n, srchHdrIsoCountryCodeFr = " + this.srchHdrIsoCountryCodeFr
			+ "\n, srchHdrIsoCountryCodeTo = " + this.srchHdrIsoCountryCodeTo
			+ "\n, srchHdrCountryAbbrFr = " + this.srchHdrCountryAbbrFr
			+ "\n, srchHdrCountryAbbrTo = " + this.srchHdrCountryAbbrTo + "}\n";

		String mandatoryStr = "{srchCompanyCode = " + this.srchCompanyCode
			+ "\n, srchHdrStatus = " + this.srchHdrStatus
			+ "}\n";

		String editStr = "{editCountryNo = " + this.editCountryNo + "}";

		return "toString() is:\n" + mandatoryStr + pkStr + colStr + editStr;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Generated Accessors (get/set methods) for searching criterias
	////////////////////////////////////////////////////////////////////////////////

	public String getSrchCompanyCode() {
		return this.srchCompanyCode;
	}

	public String getSrchHdrStatus() {
		return this.srchHdrStatus;
	}

	public String getSrchCountryCodeFr() {
		return this.srchCountryCodeFr;
	}

	public String getSrchCountryCodeTo() {
		return this.srchCountryCodeTo;
	}

	public String getSrchHdrCountryNameFr() {
		return this.srchHdrCountryNameFr;
	}

	public String getSrchHdrCountryNameTo() {
		return this.srchHdrCountryNameTo;
	}

	public String getSrchHdrIsoCountryCodeFr() {
		return this.srchHdrIsoCountryCodeFr;
	}

	public String getSrchHdrIsoCountryCodeTo() {
		return this.srchHdrIsoCountryCodeTo;
	}

	public String getSrchHdrCountryAbbrFr() {
		return this.srchHdrCountryAbbrFr;
	}

	public String getSrchHdrCountryAbbrTo() {
		return this.srchHdrCountryAbbrTo;
	}

	public String getEditCountryNo() {
		return this.editCountryNo;
	}

	public void setSrchCompanyCode(String srchCompanyCode) {
		this.srchCompanyCode = srchCompanyCode;
	}

	public void setSrchHdrStatus(String srchHdrStatus) {
		this.srchHdrStatus = srchHdrStatus;
	}

	public void setSrchCountryCodeFr(String srchCountryCodeFr) {
		this.srchCountryCodeFr = srchCountryCodeFr;
	}

	public void setSrchCountryCodeTo(String srchCountryCodeTo) {
		this.srchCountryCodeTo = srchCountryCodeTo;
	}

	public void setSrchHdrCountryNameFr(String srchHdrCountryNameFr) {
		this.srchHdrCountryNameFr = srchHdrCountryNameFr;
	}

	public void setSrchHdrCountryNameTo(String srchHdrCountryNameTo) {
		this.srchHdrCountryNameTo = srchHdrCountryNameTo;
	}

	public void setSrchHdrIsoCountryCodeFr(String srchHdrIsoCountryCodeFr) {
		this.srchHdrIsoCountryCodeFr = srchHdrIsoCountryCodeFr;
	}

	public void setSrchHdrIsoCountryCodeTo(String srchHdrIsoCountryCodeTo) {
		this.srchHdrIsoCountryCodeTo = srchHdrIsoCountryCodeTo;
	}

	public void setSrchHdrCountryAbbrFr(String srchHdrCountryAbbrFr) {
		this.srchHdrCountryAbbrFr = srchHdrCountryAbbrFr;
	}

	public void setSrchHdrCountryAbbrTo(String srchHdrCountryAbbrTo) {
		this.srchHdrCountryAbbrTo = srchHdrCountryAbbrTo;
	}

	public void setEditCountryNo(String editCountryNo) {
		this.editCountryNo = editCountryNo;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Other Accessors (get/set methods)
	////////////////////////////////////////////////////////////////////////////////

	public Iterator getSrchHdrIsoCountryCodeFrValues() {
		return this.getTemplate().getCodeDetailsValues(new CodeHdrPk(this.getSrchCompanyCode(), ProjectConstants.CD_ISO_COUNTRY_CODE));
   }


}
